/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package su.samlib.informer.database.model;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;

/**
 *
 * @author rikland
 */
@Embeddable
public class UserAuthorsPK implements Serializable {
    @Basic(optional = false)
    @Column(name = "author_id", nullable = false)
    private int authorId;
    @Basic(optional = false)
    @Column(name = "user_id", nullable = false)
    private int userId;

    public UserAuthorsPK() {
    }

    public UserAuthorsPK(int authorId, int userId) {
        this.authorId = authorId;
        this.userId = userId;
    }

    public int getAuthorId() {
        return authorId;
    }

    public void setAuthorId(int authorId) {
        this.authorId = authorId;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (int) authorId;
        hash += (int) userId;
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof UserAuthorsPK)) {
            return false;
        }
        UserAuthorsPK other = (UserAuthorsPK) object;
        if (this.authorId != other.authorId) {
            return false;
        }
        if (this.userId != other.userId) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "su.samlib.informer.database.model.UserAuthorsPK[ authorId=" + authorId + ", userId=" + userId + " ]";
    }
    
}
